<?php
require_once('../../includes/framework_ajax.php');

@$oper = $_POST['oper'];
@$page = $_GET['page']; // get the requested page
@$limit = $_GET['rows']; // get how many rows we want to have into the grid
@$sidx = $_GET['sidx']; // get index row - i.e. user click to sort
@$sord = $_GET['sord']; // get the direction
@$id = $_GET['id'];
@$cd_grupo = $_GET['form'];
@$ins = $_GET['ins'];
@$nd = $_GET['nd'];

if($oper == 'del'){
	$id = $_POST['id'];
	$delete = 'delete from tethys.tb_grupotransacoes where ci_grupotransacoes = '.$id;
	Connection::exec($delete);
}

if($oper == 'edit'){
	$id = $_POST['id'];
	$inserir = (($_POST['inserir'] == 'S')?'S':'N');
	$alterar = (($_POST['alterar'] == 'S')?'S':'N');
	$deletar = (($_POST['deletar'] == 'S')?'S':'N');

	$update = "update tethys.tb_grupotransacoes set fl_inserir = '".$inserir."', fl_alterar = '".$alterar."',
				fl_deletar = '".$deletar."'	where ci_grupotransacoes = ".$id;
	Connection::exec($update);
}

?>